package com.heima.user.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.user.pojos.ApUser;
import com.heima.user.service.ApUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/api/v1/register")
public class RegisterController {
    @Autowired
    private ApUserService userService;
    @PostMapping("/sendMsg")
    public ResponseResult register(@RequestParam("phone") String phone , HttpSession session){
        return userService.registered(phone,session);
    }
    @PostMapping("/validation")
    public ResponseResult validation(@RequestParam("phone") String phone ,@RequestParam String code, HttpSession session){

        return userService.validation(phone,code,session);
    }

    @PostMapping("/regist")
    public ResponseResult regist(@RequestBody ApUser user){
        return userService.regist(user);

    }

}
